import request from '@/utils/request';
import type {tAddAttrParam} from './model/index';
enum API {
  reqGetSpuList = '/admin/product/',
  reqTradmarkList = '/admin/product/baseTrademark/getTrademarkList',
  reqSpuImageList = '/admin/product/spuImageList/',
  reqSpuAttrList = '/admin/product/spuSaleAttrList/',
  reqBaseAttrList = '/admin/product/baseSaleAttrList',
  reqUpdateSpu = '/admin/product/updateSpuInfo',
  reqSaveSpu = '/admin/product/saveSpuInfo',
  reqAttrInfoList = '/admin/product/attrInfoList/',
  reqSaveSkuInfo = '/admin/product/saveSkuInfo',
  reqGetSkuInfo ='/admin/product/findBySpuId/',
  reqDelSpu = '/admin/product/deleteSpu/'
}

export const reqGetSpuList = (
  currentPage: number | string,
  pageSize: number | string,
  category3Id: number | string
) => {
  return request.get<any, any>(
    API.reqGetSpuList + `${currentPage}/${pageSize}?category3Id=${category3Id}`
  );
};

export const reqTradmarkList = () => {
  return request.get<any, any>(API.reqTradmarkList);
};

export const reqSpuImageList = (spuId: number) => {
  return request.get<any, any>(API.reqSpuImageList + spuId);
};

export const reqSpuAttrList = (spuId: number) => {
  return request.get<any, any>(API.reqSpuAttrList + spuId);
};

export const reqBaseAttrList = () => {
  return request.get<any, any>(API.reqBaseAttrList);
};

export const reqUpdateSpu = (data: any) => {
  return request.post<any, any>(API.reqUpdateSpu, data);
};

export const reqSaveSpu = (data:any)=>{
      return request.post<any,any>(API.reqSaveSpu,data)
}





export const reqAttrInfoList = (
  category1Id: number | string,
  category2Id: number | string,
  category3Id: number | string
) => {
  return request.get<any, tAddAttrParam[]>(
    API.reqAttrInfoList + `${category1Id}/${category2Id}/${category3Id}`
  );
};


export const reqSaveSkuInfo= (data:any)=>{
  return request.post(API.reqSaveSkuInfo,data)
}
export const reqGetSkuInfo = (spuId:number)=>{
     return request.get(API.reqGetSkuInfo+spuId)
}

export const reqDelSpu =(spuId:number)=>{
     return request.delete(API.reqDelSpu+spuId)
}